import { useContext } from "react";
import { AuthContext } from "@/App";

export function useAuth() {
  const context = useContext(AuthContext);
  if (!context) {
    throw new Error("useAuth must be used within an AuthProvider");
  }
  
  const login = () => {
    context.setIsAuthenticated(true);
  };

  const logout = () => {
    context.setIsAuthenticated(false);
  };

  return {
    isAuthenticated: context.isAuthenticated,
    login,
    logout
  };
}